import $ from "jquery";
$(function () {
  let ds = new Message(
    "59cb7a71-2b71-480a-a193-4b4fc9b63458",
    null,
    "deepseek-r1",
    "https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png",
    "assistant",
    null,
    null,
    null
  );
  ds.renderMessage($(".chat-container"));
  let user = new Message(
    "59cb7a71-2b71-480a-a193-4b4fc9b634990",
    null,
    "xiaochangming",
    "https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png",
    "user",
    null,
    null,
    null
  );
  user.renderMessage($(".chat-container"));
  let tt = new TextTool("asdfasdfasdf", "你好,很高兴为您服务");
  ds.appendTool(tt);
  user.appendTool(tt);

  setInterval(() => {
    // 从段落中不断截取一段文字，并逐个添加到工具栏中
    let p =
      '\u6211\u5df2\u7ecf\u7406\u89e3\u4e86\u60a8\u7684\u9700\u6c42\uff0c\u6211\u5c06\u521b\u5efa\u4ee5\u4e0b\u6761\u5f62\u56fe\uff0c\u5176\u7eb5\u8f74\u4e3a[1,2,3,4,5,6,7]\uff0c\u6a2a\u8f74\u4e3a1-7\u6708\u3002\u6761\u5f62\u56fe\u7684\u6bcf\u4e2a\u503c\u7531\u60a8\u63d0\u4f9b\u7684\u5217\u5411\u91cf[1.2,3.4,5.4,6.2,10.0,11.0,12.0]\u786e\u5b9a\u3002\n\n\u8fd9\u662f\u4e00\u4e2a\u5178\u578b\u7684\u6761\u5f62\u56fe\u6a21\u578b\u7684\u4ee3\u7801\uff0c\u7531\u4e8e\u6211\u4e0d\u80fd\u76f4\u63a5\u521b\u5efa\u56fe\u5f62\uff0c\u53ea\u80fd\u5c55\u793a\u5176\u4ee3\u7801\uff1a\n\n```r\n# \u521b\u5efa\u6570\u636e\u6846\ndata <- data.frame(Month = 1:7, Values = c(1.2, 3.4, 5.4, 6.2, 10.0, 11.0, 12.0))\n\n# \u4f7f\u7528ggplot2\u7ed8\u5236\u6761\u5f62\u56fe\nlibrary(ggplot2)\nggplot(data, aes(x = Month, y = Values)) +\n  geom_bar(stat = "identity") +\n  labs(title = "\u6708\u4efd\u4e0e\u6570\u503c\u6761\u5f62\u56fe") +\n  theme_minimal()\n```\n\n\u5982\u6b32\u8fd0\u884c\uff0c\u8bf7\u5728R\u4e2d\u590d\u5236\u4ee5\u4e0a\u4ee3\u7801\u3002\u8fd9\u4f1a\u521b\u5efa\u4e00\u4e2a\u6e05\u6670\u7684\u6761\u5f62\u56fe\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2a\u6761\u5f62\u8868\u793a\u4e00\u4e2a\u6708\u4efd\u5bf9\u5e94\u7684\u503c\u3002';
    let words = p.split(" ");
    let word = "";
    for (let i = 0; i < words.length; i++) {
      word += words[i] + " ";
      if (word.length > 10) {
      }
    }
    tt.stream(word);
  }, 1000);
});
